<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;

/*if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
    header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');
    exit;
}*/

/*if($_SERVER['REQUEST_METHOD'] == "GET") {
    if (!isset($_COOKIE["pageAccess"])) {
        setcookie("pageAccess", 1, time()+2592000);
        header('Access-Control-Allow-Origin: http://api.zuokexiangchun.com/');
        header('Cache-Control: no-cache');
        header('Pragma: no-cache');
        header('Access-Control-Allow-Credentials: true');
        header('Content-Type: text/plain');
    } else {
        $accesses = $_COOKIE['pageAccess'];
        setcookie('pageAccess', ++$accesses, time()+2592000);
        header('Access-Control-Allow-Origin:http://api.zuokexiangchun.com/');
        header('Access-Control-Allow-Credentials: true');
        header('Cache-Control: no-cache');
        header('Pragma: no-cache');
        header('Content-Type: text/plain');
    }
}elseif($_SERVER['REQUEST_METHOD'] == "OPTIONS"){
    if($_SERVER['HTTP_ORIGIN'] == "http://api.zuokexiangchun.com/")
    {
        header('Access-Control-Allow-Origin: http://api.zuokexiangchun.com/');
        header('Access-Control-Allow-Methods: GET, OPTIONS');
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Max-Age: 1728000');
        header("Content-Length: 0");
        header("Content-Type: text/plain");
    }else{
        header("HTTP/1.1 403 Access Forbidden");
        header("Content-Type: text/plain");
    }
}*/


// 加载基础文件
require __DIR__ . '/../thinkphp/base.php';

// 支持事先使用静态方法设置Request对象和Config对象

// 执行应用并响应
Container::get('app')->run()->send();